home *** CD-ROM | disk | FTP | other *** search
-
- {
- if(true)
- {
- CThingMath = §§newclass(CThingMath,CThingContainer);
- }
- }
-
- package Local.Game.Thing
- {
- import Local.Game.World.*;
- import Local.Math.*;
- import flash.events.*;
- import flash.geom.*;
-
- public class CThingMath extends CThingContainer
- {
-
- public static const SQRT2:Number = 1.4142135623730951;
-
- public static const mGravityDelta:CPosition;
-
- public static const SQRT1_2:Number = 0.7071067811865476;
-
- {
- if(true)
- {
- SQRT1_2 = Math.SQRT1_2;
- if(true)
- {
- SQRT2 = Math.SQRT2;
- }
- mGravityDelta = new CPosition(0,1);
- }
- }
-
- public var mBraking:Number = 1;
-
- public var mOrientation:Number = 1;
-
- public var mDelta:CPosition;
-
- public var mDestination:CPosition;
-
- public var mAngle:CAngle;
-
- public var mAcceleration:Number = 1;
-
- public var mSpeedScale:Number;
-
- public var mRandom:CRandom;
-
- public var mPosition:CPosition;
-
- public var mMaxSpeed:Number;
-
- public var mSpeed:Number;
-
- public var mAngleDelta:CAngle;
-
- public function CThingMath()
- {
- if(true)
- {
- mOrientation = 1;
- if(true)
- {
- mAcceleration = 1;
- mBraking = 1;
- }
- super();
- }
- }
-
- public static function SideOfLine(param1:Point, param2:Point, param3:Point) : Number
- {
- §§push(param2.x - param1.x);
- if(true)
- {
- §§push(param3.y - param1.y);
- if(true)
- {
- §§goto(addr53);
- }
- §§goto(addr51);
- }
- addr53:
- §§push(§§pop() * §§pop());
- if(true)
- {
- addr51:
- §§push(§§pop() - (param3.x - param1.x) * (param2.y - param1.y));
- }
- return -§§pop();
- }
-
- public static function IsLogicalAnd(param1:Number) : Boolean
- {
- var _loc2_:String = null;
- if(true)
- {
- _loc2_ = param1.toString(2);
- }
- return _loc2_.indexOf("1") == _loc2_.lastIndexOf("1");
- }
-
- public function GetOrientationMatrix() : Matrix
- {
- var _loc1_:Number = NaN;
- var _loc2_:Number = NaN;
- var _loc3_:Number = NaN;
- if(true)
- {
- _loc1_ = mAngle.mAngleRAD;
- if(true)
- {
- _loc2_ = Math.sin(_loc1_);
- }
- _loc3_ = Math.cos(_loc1_);
- }
- return new Matrix(_loc3_ * mOrientation,_loc2_ * mOrientation,-_loc2_,_loc3_,0,0);
- }
-
- public function OrientatePoints(param1:Array, param2:Array, param3:CPosition) : void
- {
- var _loc4_:Number = NaN;
- var _loc5_:Number = NaN;
- var _loc6_:Number = NaN;
- var _loc7_:Number = NaN;
- var _loc8_:Number = NaN;
- var _loc9_:int = 0;
- var _loc10_:Point = null;
- if(true)
- {
- _loc4_ = mAngle.mAngleRAD;
- if(true)
- {
- _loc5_ = Math.sin(_loc4_);
- if(true)
- {
- _loc6_ = Math.cos(_loc4_);
- _loc7_ = _loc5_ * mOrientation;
- }
- _loc8_ = _loc6_ * mOrientation;
- }
- _loc9_ = 0;
- }
- for each(_loc10_ in param1)
- {
- if(true)
- {
- param2[_loc9_++].SetXY(_loc10_.x * _loc8_ - _loc10_.y * _loc5_ + param3.x,_loc10_.x * _loc7_ + _loc10_.y * _loc6_ + param3.y);
- }
- }
- }
-
- public function Accelerate_Gradient(param1:CPosition, param2:CPosition) : void
- {
- var _loc3_:Number = NaN;
- var _loc4_:Number = NaN;
- _loc3_ = param1.length;
- _loc4_ = Math.min(mAcceleration,(mMaxSpeed - _loc3_) / mMaxSpeed * mAcceleration);
- param1.Add(CPosition.NORMALIZE(param2,_loc4_));
- }
-
- public function Accelerate_Speed() : void
- {
- if((mSpeed = mSpeed + Math.min(mAcceleration,(mMaxSpeed - mSpeed) / mMaxSpeed * mAcceleration)) > mMaxSpeed)
- {
- mSpeed = mMaxSpeed;
- }
- }
-
- public function OrientatePoint(param1:Point, param2:Point = null) : Point
- {
- var _loc3_:Number = NaN;
- var _loc4_:Number = NaN;
- var _loc5_:Number = NaN;
- var _loc6_:Number = NaN;
- var _loc7_:Number = NaN;
- if(true)
- {
- _loc3_ = mAngle.mAngleRAD;
- if(true)
- {
- _loc4_ = Math.sin(_loc3_);
- if(true)
- {
- _loc5_ = Math.cos(_loc3_);
- if(true)
- {
- _loc6_ = param1.x;
- if(true)
- {
- _loc7_ = param1.y;
- param1.x = _loc6_ * (_loc5_ * mOrientation) - _loc7_ * _loc4_;
- }
- param1.y = _loc6_ * (_loc4_ * mOrientation) + _loc7_ * _loc5_;
- }
- if(!param2)
- {
- }
- §§goto(addr103);
- }
- param1.x += param2.x;
- }
- param1.y += param2.y;
- }
- addr103:
- return param1;
- }
-
- public function get mGradient() : CPosition
- {
- var _loc1_:Number = NaN;
- var _loc2_:Number = NaN;
- var _loc3_:Number = NaN;
- _loc1_ = mAngle.mAngleRAD;
- _loc2_ = Math.sin(_loc1_);
- _loc3_ = Math.cos(_loc1_);
- §§push(§§findproperty(CPosition));
- §§push(_loc3_);
- §§push(mOrientation);
- if(true)
- {
- §§push(§§pop() * §§pop());
- §§push(_loc2_ * mOrientation);
- }
- return new §§pop().CPosition(§§pop(),§§pop());
- }
-
- public function Sign(param1:*) : Number
- {
- if(param1 < 0)
- {
- §§goto(addr32);
- }
- else
- {
- if(param1 > 0)
- {
- §§push(1);
- }
- else
- {
- §§goto(addr31);
- §§push(0);
- }
- addr32:
- -1;
- return true ? §§pop() : §§pop();
- }
- §§goto(addr31);
- }
-
- public function Deaccelerate_Speed(param1:Number = 0.33) : void
- {
- §§push(§§findproperty(mSpeed));
- §§push(mSpeed);
- §§push(mSpeed);
- if(true)
- {
- §§push(§§pop() - §§pop() * param1);
- §§push(§§pop() - §§pop() * param1);
- }
- var _loc2_:* = §§pop();
- §§pop().mSpeed = §§pop();
- if(_loc2_ < 0.3)
- {
- mSpeed = 0;
- }
- }
-
- public function Break(param1:Number = 0) : void
- {
- }
-
- public function get mPositionRef() : CPosition
- {
- return mPosition;
- }
- }
- }
-